package com.sharkburner.aeris.dao.entity;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;


/**
 * The persistent class for the site database table.
 * 
 */
@Entity
@Table(name="site")
public class Site implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(unique=true, nullable=false)
	private int id;

	@Column(length=500)
	private String descr;

	@Column(length=1000)
	private String keywords;

	@Column(length=2000)
	private String link;

	@Column(nullable=false, length=500)
	private String name;

	//bi-directional many-to-one association to Article
	@OneToMany(mappedBy="site")
	private List<Article> articles;

	//bi-directional many-to-many association to Category
    @ManyToMany
	@JoinTable(
		name="site_category"
		, joinColumns={
			@JoinColumn(name="Site_id", nullable=false)
			}
		, inverseJoinColumns={
			@JoinColumn(name="Category_name", nullable=false)
			}
		)
	private List<Category> categories;

	//bi-directional many-to-one association to UserSite
	@OneToMany(mappedBy="site")
	private List<UserSite> userSites;

    public Site() {
    }

	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getDescr() {
		return this.descr;
	}

	public void setDescr(String descr) {
		this.descr = descr;
	}

	public String getLink() {
		return this.link;
	}

	public void setLink(String link) {
		this.link = link;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public List<Article> getArticles() {
		return this.articles;
	}

	public void setArticles(List<Article> articles) {
		this.articles = articles;
	}
	
	public List<Category> getCategories() {
		return this.categories;
	}

	public void setCategories(List<Category> categories) {
		this.categories = categories;
	}
	
	public List<UserSite> getUserSites() {
		return this.userSites;
	}

	public void setUserSites(List<UserSite> userSites) {
		this.userSites = userSites;
	}

	public void setKeywords(String keywords) {
		this.keywords = keywords;
	}

	public String getKeywords() {
		return keywords;
	}
	
}